import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from tools import *
# from A_Star import *
from Dijkstra import *

if __name__ == '__main__':
    print(len(points))
    plt.figure()
    polygons = data()

    path = getPath()

    fig, ax = plt.subplots()
    ax.scatter(*points[0], color='red')
    ax.scatter(*points[34], color='red')

    for item in polygons:
        view = Polygon(item,  closed=True, edgecolor='black', facecolor='none')
        ax.add_patch(view)
    for i in range(1, len(path)):
        pre = path[i - 1]
        cur = path[i]
        ax.plot([points[pre][0], points[cur][0]],
                [points[pre][1], points[cur][1]], color='red')

    plt.xlim(-1, 500)
    plt.ylim(-500, 0)

    plt.show()